package com.google.android.gms.ads.internal;

import android.content.Context;
import android.os.Bundle;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import com.google.android.gms.ads.internal.overlay.zzn;
import com.google.android.gms.common.internal.Hide;
import com.google.android.gms.common.internal.zzbq;
import com.google.android.gms.internal.zzabh;
import com.google.android.gms.internal.zzabk;
import com.google.android.gms.internal.zzacg;
import com.google.android.gms.internal.zzada;
import com.google.android.gms.internal.zzahd;
import com.google.android.gms.internal.zzahh;
import com.google.android.gms.internal.zzahs;
import com.google.android.gms.internal.zzahw;
import com.google.android.gms.internal.zzaij;
import com.google.android.gms.internal.zzaip;
import com.google.android.gms.internal.zzala;
import com.google.android.gms.internal.zzaly;
import com.google.android.gms.internal.zzaof;
import com.google.android.gms.internal.zzhm;
import com.google.android.gms.internal.zziw;
import com.google.android.gms.internal.zziz;
import com.google.android.gms.internal.zzkk;
import com.google.android.gms.internal.zzko;
import com.google.android.gms.internal.zzlc;
import com.google.android.gms.internal.zzoi;
import com.google.android.gms.internal.zzov;
import com.google.android.gms.internal.zzro;
import com.google.android.gms.internal.zzry;
import com.google.android.gms.internal.zzvr;
import com.google.android.gms.internal.zzvy;
import com.google.android.gms.internal.zzwf;
import java.util.concurrent.Executor;
import org.json.JSONException;
import org.json.JSONObject;

@Hide
@zzabh
public abstract class zzd extends zza implements zzn, zzbm, zzvr {
    protected final zzwf zzanu;
    private transient boolean zzanv;

    public zzd(Context context, zzko zzko, String str, zzwf zzwf, zzala zzala, zzv zzv) {
        this(new zzbu(context, zzko, str, zzala), zzwf, (zzbj) null, zzv);
    }

    private zzd(zzbu zzbu, zzwf zzwf, @Nullable zzbj zzbj, zzv zzv) {
        super(zzbu, (zzbj) null, zzv);
        this.zzanu = zzwf;
        this.zzanv = false;
    }

    /* JADX WARNING: Removed duplicated region for block: B:34:0x010d  */
    /* JADX WARNING: Removed duplicated region for block: B:42:0x014c  */
    /* JADX WARNING: Removed duplicated region for block: B:43:0x0153  */
    /* JADX WARNING: Removed duplicated region for block: B:49:0x0167  */
    /* JADX WARNING: Removed duplicated region for block: B:52:0x0177  */
    /* JADX WARNING: Removed duplicated region for block: B:53:0x018e  */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    private final com.google.android.gms.internal.zzacg zza(com.google.android.gms.internal.zzkk r61, android.os.Bundle r62, com.google.android.gms.internal.zzahh r63, int r64) {
        /*
            r60 = this;
            r0 = r60
            com.google.android.gms.ads.internal.zzbu r1 = r0.zzanm
            android.content.Context r1 = r1.zzaiq
            android.content.pm.ApplicationInfo r7 = r1.getApplicationInfo()
            r1 = 0
            r2 = 0
            com.google.android.gms.ads.internal.zzbu r3 = r0.zzanm     // Catch:{ NameNotFoundException -> 0x001c }
            android.content.Context r3 = r3.zzaiq     // Catch:{ NameNotFoundException -> 0x001c }
            com.google.android.gms.internal.zzbig r3 = com.google.android.gms.internal.zzbih.zzdd(r3)     // Catch:{ NameNotFoundException -> 0x001c }
            java.lang.String r4 = r7.packageName     // Catch:{ NameNotFoundException -> 0x001c }
            android.content.pm.PackageInfo r3 = r3.getPackageInfo(r4, r2)     // Catch:{ NameNotFoundException -> 0x001c }
            r8 = r3
            goto L_0x001d
        L_0x001c:
            r8 = r1
        L_0x001d:
            com.google.android.gms.ads.internal.zzbu r3 = r0.zzanm
            android.content.Context r3 = r3.zzaiq
            android.content.res.Resources r3 = r3.getResources()
            android.util.DisplayMetrics r3 = r3.getDisplayMetrics()
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            com.google.android.gms.ads.internal.zzbv r4 = r4.zzaua
            if (r4 == 0) goto L_0x0094
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            com.google.android.gms.ads.internal.zzbv r4 = r4.zzaua
            android.view.ViewParent r4 = r4.getParent()
            if (r4 == 0) goto L_0x0094
            r4 = 2
            int[] r4 = new int[r4]
            com.google.android.gms.ads.internal.zzbu r5 = r0.zzanm
            com.google.android.gms.ads.internal.zzbv r5 = r5.zzaua
            r5.getLocationOnScreen(r4)
            r5 = r4[r2]
            r6 = 1
            r4 = r4[r6]
            com.google.android.gms.ads.internal.zzbu r9 = r0.zzanm
            com.google.android.gms.ads.internal.zzbv r9 = r9.zzaua
            int r9 = r9.getWidth()
            com.google.android.gms.ads.internal.zzbu r10 = r0.zzanm
            com.google.android.gms.ads.internal.zzbv r10 = r10.zzaua
            int r10 = r10.getHeight()
            com.google.android.gms.ads.internal.zzbu r11 = r0.zzanm
            com.google.android.gms.ads.internal.zzbv r11 = r11.zzaua
            boolean r11 = r11.isShown()
            if (r11 == 0) goto L_0x0073
            int r11 = r5 + r9
            if (r11 <= 0) goto L_0x0073
            int r11 = r4 + r10
            if (r11 <= 0) goto L_0x0073
            int r11 = r3.widthPixels
            if (r5 > r11) goto L_0x0073
            int r11 = r3.heightPixels
            if (r4 > r11) goto L_0x0073
            goto L_0x0074
        L_0x0073:
            r6 = r2
        L_0x0074:
            android.os.Bundle r11 = new android.os.Bundle
            r12 = 5
            r11.<init>(r12)
            java.lang.String r12 = "x"
            r11.putInt(r12, r5)
            java.lang.String r5 = "y"
            r11.putInt(r5, r4)
            java.lang.String r4 = "width"
            r11.putInt(r4, r9)
            java.lang.String r4 = "height"
            r11.putInt(r4, r10)
            java.lang.String r4 = "visible"
            r11.putInt(r4, r6)
            goto L_0x0095
        L_0x0094:
            r11 = r1
        L_0x0095:
            com.google.android.gms.internal.zzahi r4 = com.google.android.gms.ads.internal.zzbt.zzep()
            com.google.android.gms.internal.zzaho r4 = r4.zzpu()
            java.lang.String r9 = r4.zzqg()
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            com.google.android.gms.internal.zzahf r5 = new com.google.android.gms.internal.zzahf
            com.google.android.gms.ads.internal.zzbu r6 = r0.zzanm
            java.lang.String r6 = r6.zzatx
            r5.<init>(r9, r6)
            r4.zzaug = r5
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            com.google.android.gms.internal.zzahf r4 = r4.zzaug
            r5 = r61
            r4.zzn(r5)
            com.google.android.gms.ads.internal.zzbt.zzel()
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            android.content.Context r4 = r4.zzaiq
            com.google.android.gms.ads.internal.zzbu r6 = r0.zzanm
            com.google.android.gms.ads.internal.zzbv r6 = r6.zzaua
            com.google.android.gms.ads.internal.zzbu r10 = r0.zzanm
            com.google.android.gms.internal.zzko r10 = r10.zzaud
            java.lang.String r20 = com.google.android.gms.internal.zzaij.zza((android.content.Context) r4, (android.view.View) r6, (com.google.android.gms.internal.zzko) r10)
            r12 = 0
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            com.google.android.gms.internal.zzme r4 = r4.zzauk
            if (r4 == 0) goto L_0x00e2
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm     // Catch:{ RemoteException -> 0x00dd }
            com.google.android.gms.internal.zzme r4 = r4.zzauk     // Catch:{ RemoteException -> 0x00dd }
            long r14 = r4.getValue()     // Catch:{ RemoteException -> 0x00dd }
            r21 = r14
            goto L_0x00e4
        L_0x00dd:
            java.lang.String r4 = "Cannot get correlation id, default to 0."
            com.google.android.gms.internal.zzahw.zzcz(r4)
        L_0x00e2:
            r21 = r12
        L_0x00e4:
            java.util.UUID r4 = java.util.UUID.randomUUID()
            java.lang.String r23 = r4.toString()
            com.google.android.gms.internal.zzahq r4 = com.google.android.gms.ads.internal.zzbt.zzeq()
            com.google.android.gms.ads.internal.zzbu r6 = r0.zzanm
            android.content.Context r6 = r6.zzaiq
            android.os.Bundle r12 = r4.zza(r6, r0, r9)
            java.util.ArrayList r14 = new java.util.ArrayList
            r14.<init>()
            java.util.ArrayList r15 = new java.util.ArrayList
            r15.<init>()
            r4 = r2
        L_0x0103:
            com.google.android.gms.ads.internal.zzbu r6 = r0.zzanm
            android.support.v4.util.SimpleArrayMap<java.lang.String, com.google.android.gms.internal.zzsb> r6 = r6.zzaup
            int r6 = r6.size()
            if (r4 >= r6) goto L_0x0134
            com.google.android.gms.ads.internal.zzbu r6 = r0.zzanm
            android.support.v4.util.SimpleArrayMap<java.lang.String, com.google.android.gms.internal.zzsb> r6 = r6.zzaup
            java.lang.Object r6 = r6.keyAt(r4)
            java.lang.String r6 = (java.lang.String) r6
            r14.add(r6)
            com.google.android.gms.ads.internal.zzbu r10 = r0.zzanm
            android.support.v4.util.SimpleArrayMap<java.lang.String, com.google.android.gms.internal.zzry> r10 = r10.zzauo
            boolean r10 = r10.containsKey(r6)
            if (r10 == 0) goto L_0x0131
            com.google.android.gms.ads.internal.zzbu r10 = r0.zzanm
            android.support.v4.util.SimpleArrayMap<java.lang.String, com.google.android.gms.internal.zzry> r10 = r10.zzauo
            java.lang.Object r10 = r10.get(r6)
            if (r10 == 0) goto L_0x0131
            r15.add(r6)
        L_0x0131:
            int r4 = r4 + 1
            goto L_0x0103
        L_0x0134:
            com.google.android.gms.ads.internal.zzg r4 = new com.google.android.gms.ads.internal.zzg
            r4.<init>(r0)
            java.util.concurrent.ThreadPoolExecutor r6 = com.google.android.gms.internal.zzaid.zzdfi
            com.google.android.gms.internal.zzalt r34 = com.google.android.gms.internal.zzaid.zza((java.util.concurrent.ExecutorService) r6, r4)
            com.google.android.gms.ads.internal.zzh r4 = new com.google.android.gms.ads.internal.zzh
            r4.<init>(r0)
            java.util.concurrent.ThreadPoolExecutor r6 = com.google.android.gms.internal.zzaid.zzdfi
            com.google.android.gms.internal.zzalt r44 = com.google.android.gms.internal.zzaid.zza((java.util.concurrent.ExecutorService) r6, r4)
            if (r63 == 0) goto L_0x0153
            java.lang.String r4 = r63.zzps()
            r35 = r4
            goto L_0x0155
        L_0x0153:
            r35 = r1
        L_0x0155:
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            java.util.List<java.lang.String> r4 = r4.zzauy
            if (r4 == 0) goto L_0x01aa
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            java.util.List<java.lang.String> r4 = r4.zzauy
            int r4 = r4.size()
            if (r4 <= 0) goto L_0x01aa
            if (r8 == 0) goto L_0x0169
            int r2 = r8.versionCode
        L_0x0169:
            com.google.android.gms.internal.zzahi r4 = com.google.android.gms.ads.internal.zzbt.zzep()
            com.google.android.gms.internal.zzahy r4 = r4.zzqe()
            int r4 = r4.zzqu()
            if (r2 <= r4) goto L_0x018e
            com.google.android.gms.internal.zzahi r4 = com.google.android.gms.ads.internal.zzbt.zzep()
            com.google.android.gms.internal.zzahy r4 = r4.zzqe()
            r4.zzra()
            com.google.android.gms.internal.zzahi r4 = com.google.android.gms.ads.internal.zzbt.zzep()
            com.google.android.gms.internal.zzahy r4 = r4.zzqe()
            r4.zzac((int) r2)
            goto L_0x01aa
        L_0x018e:
            com.google.android.gms.internal.zzahi r2 = com.google.android.gms.ads.internal.zzbt.zzep()
            com.google.android.gms.internal.zzahy r2 = r2.zzqe()
            org.json.JSONObject r2 = r2.zzqz()
            if (r2 == 0) goto L_0x01aa
            com.google.android.gms.ads.internal.zzbu r4 = r0.zzanm
            java.lang.String r4 = r4.zzatx
            org.json.JSONArray r2 = r2.optJSONArray(r4)
            if (r2 == 0) goto L_0x01aa
            java.lang.String r1 = r2.toString()
        L_0x01aa:
            r46 = r1
            com.google.android.gms.internal.zzacg r1 = new com.google.android.gms.internal.zzacg
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            com.google.android.gms.internal.zzko r6 = r2.zzaud
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            java.lang.String r10 = r2.zzatx
            java.lang.String r13 = com.google.android.gms.internal.zzlc.zzil()
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            com.google.android.gms.internal.zzala r4 = r2.zzatz
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            java.util.List<java.lang.String> r2 = r2.zzauy
            r52 = r2
            com.google.android.gms.internal.zzahi r2 = com.google.android.gms.ads.internal.zzbt.zzep()
            com.google.android.gms.internal.zzahy r2 = r2.zzqe()
            boolean r16 = r2.zzqo()
            int r2 = r3.widthPixels
            r53 = r15
            int r15 = r3.heightPixels
            float r3 = r3.density
            java.util.List r24 = com.google.android.gms.internal.zzoi.zzjf()
            r54 = r2
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            java.lang.String r2 = r2.zzatw
            r55 = r2
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            com.google.android.gms.internal.zzqh r2 = r2.zzauq
            r56 = r2
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            java.lang.String r27 = r2.zzfq()
            com.google.android.gms.internal.zzaja r2 = com.google.android.gms.ads.internal.zzbt.zzfj()
            float r28 = r2.zzdp()
            com.google.android.gms.internal.zzaja r2 = com.google.android.gms.ads.internal.zzbt.zzfj()
            boolean r29 = r2.zzdq()
            com.google.android.gms.ads.internal.zzbt.zzel()
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            android.content.Context r2 = r2.zzaiq
            int r30 = com.google.android.gms.internal.zzaij.zzap(r2)
            com.google.android.gms.ads.internal.zzbt.zzel()
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            com.google.android.gms.ads.internal.zzbv r2 = r2.zzaua
            int r31 = com.google.android.gms.internal.zzaij.zzw(r2)
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            android.content.Context r2 = r2.zzaiq
            boolean r2 = r2 instanceof android.app.Activity
            r57 = r2
            com.google.android.gms.internal.zzahi r2 = com.google.android.gms.ads.internal.zzbt.zzep()
            com.google.android.gms.internal.zzahy r2 = r2.zzqe()
            boolean r33 = r2.zzqt()
            com.google.android.gms.internal.zzahi r2 = com.google.android.gms.ads.internal.zzbt.zzep()
            boolean r36 = r2.zzpx()
            com.google.android.gms.internal.zzanx r2 = com.google.android.gms.ads.internal.zzbt.zzff()
            int r37 = r2.zzts()
            com.google.android.gms.ads.internal.zzbt.zzel()
            android.os.Bundle r38 = com.google.android.gms.internal.zzaij.zzrf()
            com.google.android.gms.internal.zzaji r2 = com.google.android.gms.ads.internal.zzbt.zzev()
            java.lang.String r39 = r2.zzrq()
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            com.google.android.gms.internal.zzms r2 = r2.zzaus
            r58 = r2
            com.google.android.gms.internal.zzaji r2 = com.google.android.gms.ads.internal.zzbt.zzev()
            boolean r41 = r2.zzrr()
            com.google.android.gms.internal.zzus r2 = com.google.android.gms.internal.zzus.zzln()
            android.os.Bundle r42 = r2.asBundle()
            com.google.android.gms.internal.zzahi r2 = com.google.android.gms.ads.internal.zzbt.zzep()
            com.google.android.gms.internal.zzahy r2 = r2.zzqe()
            r59 = r3
            com.google.android.gms.ads.internal.zzbu r3 = r0.zzanm
            java.lang.String r3 = r3.zzatx
            boolean r43 = r2.zzcf(r3)
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            java.util.List<java.lang.Integer> r3 = r2.zzauu
            com.google.android.gms.ads.internal.zzbu r2 = r0.zzanm
            android.content.Context r2 = r2.zzaiq
            com.google.android.gms.internal.zzbig r2 = com.google.android.gms.internal.zzbih.zzdd(r2)
            boolean r49 = r2.zzaoe()
            com.google.android.gms.internal.zzahi r2 = com.google.android.gms.ads.internal.zzbt.zzep()
            boolean r50 = r2.zzpy()
            com.google.android.gms.ads.internal.zzbt.zzen()
            boolean r51 = com.google.android.gms.internal.zzaip.zzrk()
            r17 = r52
            r18 = r54
            r25 = r55
            r26 = r56
            r32 = r57
            r40 = r58
            r2 = r1
            r45 = r3
            r19 = r59
            r3 = r11
            r11 = r4
            r4 = r5
            r5 = r6
            r6 = r10
            r10 = r13
            r13 = r17
            r48 = r15
            r47 = r53
            r15 = r62
            r17 = r18
            r18 = r48
            r48 = r64
            r2.<init>(r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16, r17, r18, r19, r20, r21, r23, r24, r25, r26, r27, r28, r29, r30, r31, r32, r33, r34, r35, r36, r37, r38, r39, r40, r41, r42, r43, r44, r45, r46, r47, r48, r49, r50, r51)
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.ads.internal.zzd.zza(com.google.android.gms.internal.zzkk, android.os.Bundle, com.google.android.gms.internal.zzahh, int):com.google.android.gms.internal.zzacg");
    }

    @Nullable
    static String zzc(zzahd zzahd) {
        if (zzahd == null) {
            return null;
        }
        String str = zzahd.zzcjg;
        if (("com.google.android.gms.ads.mediation.customevent.CustomEventAdapter".equals(str) || "com.google.ads.mediation.customevent.CustomEventAdapter".equals(str)) && zzahd.zzcje != null) {
            try {
                return new JSONObject(zzahd.zzcje.zzchk).getString("class_name");
            } catch (NullPointerException | JSONException unused) {
            }
        }
        return str;
    }

    @Nullable
    public final String getMediationAdapterClassName() {
        if (this.zzanm.zzaue == null) {
            return null;
        }
        return this.zzanm.zzaue.zzcjg;
    }

    public void onAdClicked() {
        if (this.zzanm.zzaue == null) {
            zzahw.zzcz("Ad state was null when trying to ping click URLs.");
            return;
        }
        if (!(this.zzanm.zzaue.zzdcj == null || this.zzanm.zzaue.zzdcj.zzchw == null)) {
            zzbt.zzfd();
            zzvy.zza(this.zzanm.zzaiq, this.zzanm.zzatz.zzcu, this.zzanm.zzaue, this.zzanm.zzatx, false, zzc(this.zzanm.zzaue.zzdcj.zzchw));
        }
        if (!(this.zzanm.zzaue.zzcje == null || this.zzanm.zzaue.zzcje.zzchg == null)) {
            zzbt.zzfd();
            zzvy.zza(this.zzanm.zzaiq, this.zzanm.zzatz.zzcu, this.zzanm.zzaue, this.zzanm.zzatx, false, this.zzanm.zzaue.zzcje.zzchg);
        }
        super.onAdClicked();
    }

    public final void onPause() {
        this.zzano.zzj(this.zzanm.zzaue);
    }

    public final void onResume() {
        this.zzano.zzk(this.zzanm.zzaue);
    }

    public void pause() {
        zzbq.zzgn("pause must be called on the main UI thread.");
        if (!(this.zzanm.zzaue == null || this.zzanm.zzaue.zzcnm == null || !this.zzanm.zzfo())) {
            zzbt.zzen();
            zzaip.zzh(this.zzanm.zzaue.zzcnm);
        }
        if (!(this.zzanm.zzaue == null || this.zzanm.zzaue.zzcjf == null)) {
            try {
                this.zzanm.zzaue.zzcjf.pause();
            } catch (RemoteException unused) {
                zzahw.zzcz("Could not pause mediation adapter.");
            }
        }
        this.zzano.zzj(this.zzanm.zzaue);
        this.zzanl.pause();
    }

    public final void recordImpression() {
        zza(this.zzanm.zzaue, false);
    }

    public void resume() {
        zzbq.zzgn("resume must be called on the main UI thread.");
        zzaof zzaof = (this.zzanm.zzaue == null || this.zzanm.zzaue.zzcnm == null) ? null : this.zzanm.zzaue.zzcnm;
        if (zzaof != null && this.zzanm.zzfo()) {
            zzbt.zzen();
            zzaip.zzi(this.zzanm.zzaue.zzcnm);
        }
        if (!(this.zzanm.zzaue == null || this.zzanm.zzaue.zzcjf == null)) {
            try {
                this.zzanm.zzaue.zzcjf.resume();
            } catch (RemoteException unused) {
                zzahw.zzcz("Could not resume mediation adapter.");
            }
        }
        if (zzaof == null || !zzaof.zzug()) {
            this.zzanl.resume();
        }
        this.zzano.zzk(this.zzanm.zzaue);
    }

    public void showInterstitial() {
        zzahw.zzcz("showInterstitial is not supported for current ad type");
    }

    /* access modifiers changed from: protected */
    public void zza(@Nullable zzahd zzahd, boolean z) {
        if (zzahd == null) {
            zzahw.zzcz("Ad state was null when trying to ping impression URLs.");
            return;
        }
        if (zzahd == null) {
            zzahw.zzcz("Ad state was null when trying to ping impression URLs.");
        } else {
            zzahw.zzby("Pinging Impression URLs.");
            if (this.zzanm.zzaug != null) {
                this.zzanm.zzaug.zzpk();
            }
            zzahd.zzdcu.zza(zziw.zza.zzb.AD_IMPRESSION);
            if (zzahd.zzchx != null && !zzahd.zzdcq) {
                zzbt.zzel();
                zzaij.zza(this.zzanm.zzaiq, this.zzanm.zzatz.zzcu, zzc(zzahd.zzchx));
                zzahd.zzdcq = true;
            }
        }
        if (!zzahd.zzdcr || z) {
            if (!(zzahd.zzdcj == null || zzahd.zzdcj.zzchx == null)) {
                zzbt.zzfd();
                zzvy.zza(this.zzanm.zzaiq, this.zzanm.zzatz.zzcu, zzahd, this.zzanm.zzatx, z, zzc(zzahd.zzdcj.zzchx));
            }
            if (!(zzahd.zzcje == null || zzahd.zzcje.zzchh == null)) {
                zzbt.zzfd();
                zzvy.zza(this.zzanm.zzaiq, this.zzanm.zzatz.zzcu, zzahd, this.zzanm.zzatx, z, zzahd.zzcje.zzchh);
            }
            zzahd.zzdcr = true;
        }
    }

    public final void zza(zzro zzro, String str) {
        String str2;
        zzry zzry = null;
        if (zzro != null) {
            try {
                str2 = zzro.getCustomTemplateId();
            } catch (RemoteException e) {
                zzahw.zzc("Unable to call onCustomClick.", e);
                return;
            }
        } else {
            str2 = null;
        }
        if (!(this.zzanm.zzauo == null || str2 == null)) {
            zzry = this.zzanm.zzauo.get(str2);
        }
        if (zzry == null) {
            zzahw.zzcz("Mediation adapter invoked onCustomClick but no listeners were set.");
        } else {
            zzry.zzb(zzro, str);
        }
    }

    public final boolean zza(zzacg zzacg, zzov zzov) {
        this.zzanh = zzov;
        zzov.zzf("seq_num", zzacg.zzcry);
        zzov.zzf("request_id", zzacg.zzcsi);
        zzov.zzf("session_id", zzacg.zzcrz);
        if (zzacg.zzcrw != null) {
            zzov.zzf("app_version", String.valueOf(zzacg.zzcrw.versionCode));
        }
        zzbu zzbu = this.zzanm;
        zzbt.zzeh();
        Context context = this.zzanm.zzaiq;
        zziz zziz = this.zzanp.zzaon;
        zzahs zzada = zzacg.zzcrv.extras.getBundle("sdk_less_server_data") != null ? new zzada(context, zzacg, this, zziz) : new zzabk(context, zzacg, this, zziz);
        zzada.zzqj();
        zzbu.zzaub = zzada;
        return true;
    }

    /* access modifiers changed from: package-private */
    public final boolean zza(zzahd zzahd) {
        zzkk zzkk;
        boolean z = false;
        if (this.zzann != null) {
            zzkk = this.zzann;
            this.zzann = null;
        } else {
            zzkk = zzahd.zzcrv;
            if (zzkk.extras != null) {
                z = zzkk.extras.getBoolean("_noRefresh", false);
            }
        }
        return zza(zzkk, zzahd, z);
    }

    /* access modifiers changed from: protected */
    public boolean zza(@Nullable zzahd zzahd, zzahd zzahd2) {
        int i;
        if (!(zzahd == null || zzahd.zzcjh == null)) {
            zzahd.zzcjh.zza((zzvr) null);
        }
        if (zzahd2.zzcjh != null) {
            zzahd2.zzcjh.zza((zzvr) this);
        }
        int i2 = 0;
        if (zzahd2.zzdcj != null) {
            i2 = zzahd2.zzdcj.zzcik;
            i = zzahd2.zzdcj.zzcil;
        } else {
            i = 0;
        }
        this.zzanm.zzauz.zze(i2, i);
        return true;
    }

    /* access modifiers changed from: protected */
    public boolean zza(zzkk zzkk, zzahd zzahd, boolean z) {
        zzbj zzbj;
        long j;
        if (!z && this.zzanm.zzfo()) {
            if (zzahd.zzcic > 0) {
                zzbj = this.zzanl;
                j = zzahd.zzcic;
            } else if (zzahd.zzdcj != null && zzahd.zzdcj.zzcic > 0) {
                zzbj = this.zzanl;
                j = zzahd.zzdcj.zzcic;
            } else if (!zzahd.zzcto && zzahd.errorCode == 2) {
                this.zzanl.zzg(zzkk);
            }
            zzbj.zza(zzkk, j);
        }
        return this.zzanl.zzea();
    }

    public boolean zza(zzkk zzkk, zzov zzov) {
        return zza(zzkk, zzov, 1);
    }

    public final boolean zza(zzkk zzkk, zzov zzov, int i) {
        zzahh zzahh;
        if (!zzce()) {
            return false;
        }
        zzbt.zzel();
        zzhm zzad = zzbt.zzep().zzad(this.zzanm.zzaiq);
        String str = null;
        Bundle zza = zzad == null ? null : zzaij.zza(zzad);
        this.zzanl.cancel();
        this.zzanm.zzavb = 0;
        if (((Boolean) zzlc.zzio().zzd(zzoi.zzbti)).booleanValue()) {
            zzahh = zzbt.zzep().zzqe().zzqv();
            zzac zzet = zzbt.zzet();
            Context context = this.zzanm.zzaiq;
            zzala zzala = this.zzanm.zzatz;
            String str2 = this.zzanm.zzatx;
            if (zzahh != null) {
                str = zzahh.getAppId();
            }
            zzet.zza(context, zzala, false, zzahh, str, str2, (Runnable) null);
        } else {
            zzahh = null;
        }
        return zza(zza(zzkk, zza, zzahh, i), zzov);
    }

    public final void zzb(zzahd zzahd) {
        super.zzb(zzahd);
        if (zzahd.zzcje != null) {
            zzahw.zzby("Disable the debug gesture detector on the mediation ad frame.");
            if (this.zzanm.zzaua != null) {
                this.zzanm.zzaua.zzfu();
            }
            zzahw.zzby("Pinging network fill URLs.");
            zzbt.zzfd();
            zzvy.zza(this.zzanm.zzaiq, this.zzanm.zzatz.zzcu, zzahd, this.zzanm.zzatx, false, zzahd.zzcje.zzchj);
            if (!(zzahd.zzdcj == null || zzahd.zzdcj.zzchz == null || zzahd.zzdcj.zzchz.size() <= 0)) {
                zzahw.zzby("Pinging urls remotely");
                zzbt.zzel().zza(this.zzanm.zzaiq, zzahd.zzdcj.zzchz);
            }
        } else {
            zzahw.zzby("Enable the debug gesture detector on the admob ad frame.");
            if (this.zzanm.zzaua != null) {
                this.zzanm.zzaua.zzft();
            }
        }
        if (zzahd.errorCode == 3 && zzahd.zzdcj != null && zzahd.zzdcj.zzchy != null) {
            zzahw.zzby("Pinging no fill URLs.");
            zzbt.zzfd();
            zzvy.zza(this.zzanm.zzaiq, this.zzanm.zzatz.zzcu, zzahd, this.zzanm.zzatx, false, zzahd.zzdcj.zzchy);
        }
    }

    public final void zzc(String str, String str2) {
        onAppEvent(str, str2);
    }

    /* access modifiers changed from: protected */
    public final boolean zzc(zzkk zzkk) {
        return super.zzc(zzkk) && !this.zzanv;
    }

    /* access modifiers changed from: protected */
    public boolean zzce() {
        zzbt.zzel();
        if (!zzaij.zzd(this.zzanm.zzaiq, this.zzanm.zzaiq.getPackageName(), "android.permission.INTERNET")) {
            return false;
        }
        zzbt.zzel();
        return zzaij.zzag(this.zzanm.zzaiq);
    }

    public void zzcf() {
        this.zzanv = false;
        zzbt();
        this.zzanm.zzaug.zzpm();
    }

    public void zzcg() {
        this.zzanv = true;
        zzbv();
    }

    public void zzch() {
        zzahw.zzcz("Mediated ad does not support onVideoEnd callback");
    }

    public void zzci() {
        onAdClicked();
    }

    public final void zzcj() {
        zzcf();
    }

    public final void zzck() {
        zzbu();
    }

    public final void zzcl() {
        zzcg();
    }

    public final void zzcm() {
        if (this.zzanm.zzaue != null) {
            String str = this.zzanm.zzaue.zzcjg;
            StringBuilder sb = new StringBuilder(74 + String.valueOf(str).length());
            sb.append("Mediation adapter ");
            sb.append(str);
            sb.append(" refreshed, but mediation adapters should never refresh.");
            zzahw.zzcz(sb.toString());
        }
        zza(this.zzanm.zzaue, true);
        zzbw();
    }

    public void zzcn() {
        recordImpression();
    }

    @Nullable
    public final String zzco() {
        if (this.zzanm.zzaue == null) {
            return null;
        }
        return zzc(this.zzanm.zzaue);
    }

    public final void zzcp() {
        Executor executor = zzaly.zzdjt;
        zzbj zzbj = this.zzanl;
        zzbj.getClass();
        executor.execute(zze.zza(zzbj));
    }

    public final void zzcq() {
        Executor executor = zzaly.zzdjt;
        zzbj zzbj = this.zzanl;
        zzbj.getClass();
        executor.execute(zzf.zza(zzbj));
    }
}
